<script>
import {h, ref, defineComponent} from "vue";
import studentCommunal from "@/components/communal/student-communal.vue";
import {RouterLink} from "vue-router";
import {BookOutline as BookIcon} from "@vicons/ionicons5";
import {NIcon} from "naive-ui";

export default defineComponent({
  name: "learn-communal",
  props:{
    actionKey:{
      type:String
    },
    core: {
      type: Boolean,
      default: true
    },
  },
  components:{studentCommunal},
  setup(){
    function renderIcon(icon) {
      return () => h(NIcon, null, { default: () => h(icon) });
    }
    const menuOptions = [
      {
        label: () => h(
            RouterLink,
            {
              to: {
                name: "std/curriculum",
              }
            },
            { default: () => "课程" }
        ),
        key: "communal",
        icon: renderIcon(BookIcon)
      },
      {
        label: () => h(
            RouterLink,
            {
              to: {
                name: "std/forum",
              }
            },
            { default: () => "代码社区" }
        ),
        key: "forum",
        icon: renderIcon(BookIcon)
      },
      {
        label: () => h(
            RouterLink,
            {
              to: {
                name: "std/model",
              }
            },
            { default: () => "模型实验" }
        ),
        key: "model",
        icon: renderIcon(BookIcon)
      },
    ];
    return{
      menuOption: ref(menuOptions)
    }
  }
})
</script>

<template>
  <student-communal :option="menuOption" action="learn" :navKey="actionKey" :core="core">
    <slot/>
  </student-communal>
</template>

<style scoped>

</style>